package problem;

public class problem1 {
    //编写程序，计算1-10的各个乘数的阶乘
    public static void main(String[] args) {
        for (int i = 1; i < 11; i++) {
            int factorial = 1;
            for (int j = 1; j <= i; j++) {
                factorial *= j;
            }

            System.out.println( i + "的阶乘为:" + factorial);
        }

    }


    //用while循环，求1-100之和
    public static void main3(String[] args) {
        int sum = 0;
        int i = 1;
        while (i < 101) {
            sum += i;
            i++;
        }
        System.out.println(sum);
    }


    //编写程序输出 1-200的偶数和
    public static void main2(String[] args) {
        int sum = 0;
        for (int i = 2; i <= 200; i = i + 2) {
            sum += i;
        }
        System.out.println(sum);;
    }


    //用for循环，求1-100的和
    public static void main1(String[] args) {
        int sum = 0;
        for (int i = 1; i < 101 ; i++) {
            sum += i;
        }
        System.out.println(sum);
    }
}
